package com.learn.ert.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.learn.ert.base.BaseApiService;
import com.learn.ert.base.BaseResponse;
import com.learn.ert.mapper.ErEmpMapper;
import com.learn.ert.pojo.ErEmpEntity;
import com.learn.ert.service.ErEmpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;


/**
 * 
 *
 * @author sjf
 * @email 2334593702@qq.com
 * @date 2020-08-14 17:47:02
 */
@RestController
@RequestMapping("api/eremp")
@CrossOrigin
@Api(tags = "员工信息接口")
public class ErEmpController extends BaseApiService<JSONObject> {

    @Autowired
    private ErEmpService erEmpService;

    @GetMapping("/allEmp")
    @ApiOperation(value = "员工信息查询接口", notes = "员工信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "eId", value = "姓名", required = true,
            dataType = "String")})



    public BaseResponse<JSONObject> allEmp(ErEmpEntity erEmpEntity){

        HashMap<Object, Object> empHashMap = new HashMap<Object, Object>();
//        QueryWrapper<ErEmpEntity> queryWrapper = new QueryWrapper<ErEmpEntity>();
//        queryWrapper.eq(StringUtils.isNoneEmpty(erEmpEntity.getEId().toString()),"e_id",erEmpEntity.getEId().toString());
        List<ErEmpEntity> empEntityList= erEmpService.getlist();
        empHashMap.put("list",empEntityList);
        return setResultSuccess((JSONObject) JSONObject.toJSON(empHashMap));
    }

}
